# -*- coding: utf-8 -*
#!\usr\bin\python3

import os
import sys
import shutil


# android_project_path = "D:\U3d\suzhou\Android_Copy"
# os.system("cd /d {0}".format(android_project_path))
# os.system("dir")

# print("cd /d {0} ".format(android_project_path))

os.system("java -version")

#os.system("ping -t 127.0.0.1")

# os.execlp("","ping","-t","127.0.0.1")

# os.execlp("ipconfig","/all")

# os.execlp("java","-version")

# os.execlp("ping","-t","127.0.0.1")

# os.system("ping -t 127.0.0.1")
#os.execlp("javac","-version","-version")
#os.execlp("ping","____","-t","127.0.0.1")


#1打包android工程参考流程
#java源代码编译
    #a.生成r.java文件
    #E:\Java\SDKManager\build-tools\25.0.2\aapt package -m -J gen -S res -I E:\Java\SDKManager\platforms\android-25\android.jar -M AndroidManifest.xml

#b.生成.class文件   -cp 也可以代替-classpath
    #javac -source 1.7 -target 1.7 -g -verbose -bootclasspath E:\Java\SDKManager\platforms\android-25\android.jar -d bin src\com\laka\AnhuiSuzhouQipaiYouxi\*.java src\com\laka\AnhuiSuzhouQipaiYouxi\LBS\CommonTools\*.java src\com\laka\AnhuiSuzhouQipaiYouxi\wxapi\*.java gen\com\laka\AnhuiSuzhouQipaiYouxi\*.java -classpath assets\yayavoice_for_assets.jar;libs\unity-classes.jar;libs\android-support-v4.jar;libs\appkefu_kefu_sdk4.jar;libs\bugly.jar;libs\buglyagent.jar;libs\TencentLocationSDK_v6.1.2_r1df4baaa_170627_1056.jar;libs\umeng-analytics-v6.1.0.jar;libs\wechat-sdk-android-without-mta-1.0.2.jar;libs\yayavoice_libs_20170406.jar;D:\U3d\suzhou\PushSDK\libs\alicloud-android-sdk-httpdns-1.0.7.jar;D:\U3d\suzhou\PushSDK\libs\com.umeng.message_3.1.1a.jar;D:\U3d\suzhou\PushSDK\libs\utdid4all-1.1.5.3_proguard.jar
    # -classpath 注意要点 
    # 1.如果是相对路径，直接使用文件夹名称libs
    # 2.斜杠需要使用 \
    # 3.多个jar包需要使用分号分隔 ;
    # 4.多个jar包之间需要把名称全部填写完全 不能使用*.jar代替

#c.根据需要生成.aidl文件  暂不需要理会


#2打包成dex  集成第三方包
#E:\Java\SDKManager\build-tools\25.0.1\dx.bat --dex --output=D:\U3d\suzhou\Android_Copy\bin\classes.dex D:\U3d\suzhou\Android_Copy\bin 
#E:\Java\SDKManager\build-tools\25.0.1\dx.bat --dex --output=D:\U3d\suzhou\Android_Copy\bin\classes.dex D:\U3d\suzhou\Android_Copy\bin D:\U3d\suzhou\Android_Copy\assets\yayavoice_for_assets.jar D:\U3d\suzhou\Android_Copy\libs\unity-classes.jar D:\U3d\suzhou\Android_Copy\libs\android-support-v4.jar D:\U3d\suzhou\Android_Copy\libs\appkefu_kefu_sdk4.jar D:\U3d\suzhou\Android_Copy\libs\bugly.jar D:\U3d\suzhou\Android_Copy\libs\buglyagent.jar D:\U3d\suzhou\Android_Copy\libs\TencentLocationSDK_v6.1.2_r1df4baaa_170627_1056.jar D:\U3d\suzhou\Android_Copy\libs\umeng-analytics-v6.1.0.jar D:\U3d\suzhou\Android_Copy\libs\wechat-sdk-android-without-mta-1.0.2.jar D:\U3d\suzhou\Android_Copy\libs\yayavoice_libs_20170406.jar D:\U3d\suzhou\PushSDK\libs\alicloud-android-sdk-httpdns-1.0.7.jar D:\U3d\suzhou\PushSDK\libs\com.umeng.message_3.1.1a.jar D:\U3d\suzhou\PushSDK\libs\utdid4all-1.1.5.3_proguard.jar


#3整合各种资源打包为可以打包成apk的包
#E:\Java\SDKManager\build-tools\25.0.2\aapt package -f -S res -A assets -I E:\Java\SDKManager\platforms\android-25\android.jar -M AndroidManifest.xml -F bin\AutoPackResources 

##4添加 .so库


#4打包成无签名apk
#java -cp E:\Java\SDKManager\tools\lib\sdklib.jar com.android.sdklib.build.ApkBuilderMain tempApk\AutoPack.apk -v -u -z bin\AutoPackResources -nf libs -f bin\classes.dex

#5为apk添加签名
#jarsigner -verbose -keystore D:\U3d\suzhou\Android_Copy\signedFile\lakagame.keystore -storepass laka1808 -signedjar D:\U3d\suzhou\Android_Copy\tempApk\AutoPackSigned.apk D:\U3d\suzhou\Android_Copy\tempApk\AutoPack.apk laka

#####jarsigner -verbose -keystore lakagame.keystore -storepass laka1808 -signedjar AutoPackSigned.apk AutoPack.apk laka
#keystore ：keystore文件位置
#storepass ： 密码
#signedjar [签名后的文件] [需要签名的文件]
#laka  : 别名alias

#查询证书信息  
#keytool -list -v -keystore D:\U3d\suzhou\Android_Copy\signedFile\lakagame.keystore -storepass laka1808

#查询是否签名成功
# jarsigner -verify AutoPackSigned.apk


#E:\Java\SDKManager\build-tools\25.0.2\aapt remove D:\U3d\suzhou\Android_Copy\tempApk\suzhou20170815.apk assets




 



# java -cp E:\Java\SDKManager\tools\lib\sdklib.jar com.android.sdklib.build.ApkBuilderMain D:\\U3d\\suzhou\\Android_Copy\\TempForder\\ApkFolder\\_AutoPack.apk -v -u -z D:\\U3d\\suzhou\\Android_Copy\\bin\\AutoPackResources -nf libs -f bin\classes.dex

# java -cp E:\\Java\\SDKManager\\tools\\lib\\sdklib.jar com.android.sdklib.build.ApkBuilderMain D:\\U3d\\suzhou\\Android_Copy\\TempForder\\ApkFolder\\_AutoPack.apk -v -u -z D:\\U3d\\suzhou\\Android_Copy\\bin\\AutoPackResources -nf D:\\U3d\\suzhou\\Android_Copy\\libs\\armeabi-v7a\\libBugly.so D:\\U3d\\suzhou\\Android_Copy\\libs\\armeabi-v7a\\libmain.so D:\\U3d\\suzhou\\Android_Copy\\libs\\armeabi-v7a\\libmono.so D:\\U3d\\suzhou\\Android_Copy\\libs\\armeabi-v7a\\libtencentloc.so D:\\U3d\\suzhou\\Android_Copy\\libs\\armeabi-v7a\\libtolua.so D:\\U3d\\suzhou\\Android_Copy\\libs\\armeabi-v7a\\libunity.soD:\\U3d\\suzhou\\Android_Copy\\libs\\armeabi-v7a\\libYvImSdk.so D:\\U3d\\suzhou\\Android_Copy\\libs\\x86\\libBugly.so D:\\U3d\\suzhou\\Android_Copy\\libs\\x86\\libmain.so D:\\U3d\\suzhou\\Android_Copy\\libs\\x86\\libmono.so D:\\U3d\\suzhou\\Android_Copy\\libs\\x86\\libtencentloc.so D:\\U3d\\suzhou\\Android_Copy\\libs\\x86\\libtolua.so D:\\U3d\\suzhou\\Android_Copy\\libs\\x86\\libunity.so D:\\U3d\\suzhou\\Android_Copy\\libs\\x86\\libYvImSdk.so  -f D:\\U3d\\suzhou\\Android_Copy\\bin\\classes.dex





